package com.wl.test;

import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author wanlei
 * @since 2021/11/05
 */
@Service
public class MapService {

    Map<String,TestZR> map = new HashMap<>();

    public MapService(List<TestZR> list){
        if(!CollectionUtils.isEmpty(list)){
            System.out.println("map add test");
            list.forEach(item -> {
                map.put(item.getType(),item);
            });
        }
        System.out.println("size="+list.size());
    }

    public void execute(String type){
        map.get(type).testGetName();
    }

}
